package com.regent;

import com.bstek.ureport.console.UReportServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;


@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class,ServletWebServerFactoryAutoConfiguration.class})
@ImportResource("classpath:context.xml")
public class CentralReportWebApplication extends SpringBootServletInitializer{

	public static void main(String[] args) {
		SpringApplication.run(CentralReportWebApplication.class, args);
	}

	@Bean
	public ServletRegistrationBean buildUreportServlet(){
		return new ServletRegistrationBean(new UReportServlet(),"/ureport/*");
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(CentralReportWebApplication.class);
	}
}
